//////////////////////////////////////////////////
// EASIM project
// easim.net.Test
// 2007/6/6 12:56
// Cong Liu
// gzcong@gmail.com

// Copyright (C) 2007
// All rights reserved.
// Refer to LICENSE of JIST (Java In Simulation Time) for terms and conditions of use.

package easim.net;

import jist.swans.misc.Message;
import jist.swans.Constants;

import jist.runtime.JistAPI;

public class Test
{

  static class Node1 extends easim.net.Node
  {
    public Node1(int id) {
      super(id);
    }

    public void receive(Message msg, int srcId, int dstId) {
      System.out.println(id + " " + x + " " + y + " " + Clock.getTime());
      System.out.println(" received: " + msg + " " + srcId + " " + dstId);
    }

    public void pump(int queueSize, boolean macBusy) {
    }

  }

  public static void main(String[] args) {
    Node node1 = new Node1(1);
    Node node2 = new Node1(2);
    Field.add(node1, 1, 1);
    Field.add(node2, 500, 1);
    for (int i = 1; i <= 900; i += 1) {
      node2.send(Message.NULL, Node.ADDRESS_ANY);
      JistAPI.sleepBlock(Constants.SECOND);
      Field.move(node1, i, 1);
    }
  }

}
